package com.ty.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ty.entity.BookTypeEntity;
import com.ty.mapper.BookTypeMapper;
import com.ty.service.IBookTypeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 *
 * @author : txy
 * @create : 2024/1/10 13:50
 */
@Service
public class BookTypeServiceImpl extends ServiceImpl<BookTypeMapper, BookTypeEntity>  implements IBookTypeService {
    @Resource
    private BookTypeMapper typeMapper;
    @Override
    public BookTypeEntity selectByTypeId(Integer id) {
        return typeMapper.selectByTypeId(id);
    }

    @Override
    public BookTypeEntity selectByTypeName(String name) {
        return typeMapper.selectByTypeName(name);
    }
    @Override
    public List<BookTypeEntity> selectAll(){
        QueryWrapper<BookTypeEntity> wrapper = new QueryWrapper<>();
        QueryWrapper<BookTypeEntity> result = wrapper.select();
        return typeMapper.selectList(result);
    }
}
